package com.cms.admin.service.patient.impl;

import com.cms.admin.mapper.PatientListMapper;
import com.cms.admin.model.PageBean;
import com.cms.admin.model.PatientList;
import com.cms.admin.model.PatientListExt;
import com.cms.admin.model.UserListExt;
import com.cms.admin.service.patient.PatientService;

import java.util.List;

/**
 * Created by YYY-Work on 2017/4/26.
 */
public class PatientServiceImpl implements PatientService {

    private PatientListMapper patientListMapper;

    @Override
    public List<PatientList> getPatient(PageBean page, PatientListExt patientListExt){

        int count = getRowCount(patientListExt);
        page.setAllRow(count);

        patientListExt.setOffset(page.getOffset());
        patientListExt.setPageSize(page.getPageSize());
        List<PatientList> aaaa= patientListMapper.selectByConditionWithLimit(patientListExt);
        return aaaa;
    }

    public PatientListMapper getPatientListMapper() {
        return patientListMapper;
    }

    public void setPatientListMapper(PatientListMapper patientListMapper) {
        this.patientListMapper = patientListMapper;
    }

    public int getRowCount(PatientListExt example) {
        // TODO Auto-generated method stub
        return patientListMapper.countByCondition(example);
    }
}
